package com.alterzhang.userservice.zk;

/**
 * Created by zhangshuhan on 2019/2/27.
 */
public class TicketThread implements Runnable {
    private int count = 100;
    ZKSynLock zkSynLock= new ZKSynLock();

    @Override
    public void run() {
        while (count > 0) {
            String name = Thread.currentThread().getName();
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            zkSynLock.lock();
            System.out.println("线程name:" + name + "出票:" + count);
            count = count - 1;
            zkSynLock.unlock();
        }
    }
}

